const loaderUtils = require('loader-utils');
function loader(source){
    let script = (`
       let style = document.createElement('style');
       style.innerHTML = ${JSON.stringify(source)};
       document.head.appendChild(style);
    `);
    return script;
}
loader.pitch = function(remainingRequest,previousRequest,data){
    console.log('style-loader pitch',remainingRequest);
    let importLoader = 2;
    //"!!../loaders/css-loader.js!./style.css"
    debugger;
     let script = (`
       let style = document.createElement('style');
       style.innerHTML = require(${loaderUtils.stringifyRequest(this, "!!" + remainingRequest)});
       document.head.appendChild(style);
    `);
    return script;
}
module.exports = loader;
//pitch如果有两个最左侧的loader要联合使用，
//如果不加!!会出现死循环
// css-loader!style.css
//style-loader css-loader
//style-loader.pitch
